package by.dvrudenko.avtobaza.webapp.page.createResponses.panel;

import org.apache.wicket.AttributeModifier;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;

import by.dvrudenko.avtobaza.datamodel.Responses;
import by.dvrudenko.avtobaza.webapp.page.AbstractPanel;

public class ResponsesDetailsPanel extends AbstractPanel {
	
	private Responses response;
	private boolean isLast;
	
	public ResponsesDetailsPanel(String id) {
		super(id);
	}
	
	public ResponsesDetailsPanel(String id, Responses response, boolean isLast) {
		super(id);
		this.response = response;
		this.isLast = isLast;
	}

	@Override
	protected void onInitialize() {
		super.onInitialize();

		WebMarkupContainer divContainer = new WebMarkupContainer("wrapper-div");
		if (isLast) {
			divContainer.add(AttributeModifier.append("class", "footbox last"));
		}
		add(divContainer);	
		WebMarkupContainer hContaiener = new WebMarkupContainer("wrapper-h");
		hContaiener.add(new Label("responsesUserTitle", response.getUser().getName()));
		divContainer.add(hContaiener);
		divContainer.add(new Label("responsesUserText", response.getResponsesText()));

	}
	

}
